﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using LeadExpress.Models.ViewPages;

namespace LeadExpress.Repository
{
    public class DistrictManagementRepository : BaseManagementRepository
    {
        LeadExpressEntities entities = new LeadExpressEntities();

        public DistrictManagementModel GetModel(string pageType, string roleName)
        {
            DistrictManagementModel model = new DistrictManagementModel();

            model.HeaderView = GetHeader();
            model.MenuItem = GetMenuItems(roleName, pageType);
            model.ListDistrict = new Repository.DistrictRepository().GetAll();

            return model;
        }

        public DistrictManagementModel GetModelAdd(string pageType, string roleName)
        {
            DistrictManagementModel model = new DistrictManagementModel();

            model.HeaderView = GetHeader();
            model.MenuItem = GetMenuItems(roleName, pageType);
            model.ListState = new Repository.StateRepository().GetAll();

            return model;
        }

        public DistrictManagementModel GetModelEdit(string pageType, string roleName, int id)
        {
            DistrictManagementModel model = new DistrictManagementModel();

            model.HeaderView = GetHeader();
            model.MenuItem = GetMenuItems(roleName, pageType);
            model.ListState = new Repository.StateRepository().GetAll();

            if (id > 0)
            {
                model.DistrictInfo = new Repository.DistrictRepository().GetSingle(id);
            }

            return model;
        }

        public DistrictManagementModel GetModelDelete(string pageType, string roleName)
        {
            DistrictManagementModel model = new DistrictManagementModel();
            model.ListDistrict = new Repository.DistrictRepository().GetAll();

            return model;
        }
    }
}